Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.pacist.diamonds.AngularController

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.pacist.diamonds.DiamondCanvas
                    |
                    +--com.pacist.diamonds.Controller
                          |
                          +--com.pacist.diamonds.AngularController
Subclasses:
Knob, Meter

public class AngularController
extends Controller
A component implementing a rotating controller such as a knob or meter. It can be used for the display or entry of numeric values.

See Also:
Serialized Form

Fields inherited from class com.pacist.diamonds.Controller
canMeasure, listeners, maxValue, minValue, postOnMouseDown, postWhileDragging, showValue, value
 
Fields inherited from class com.pacist.diamonds.DiamondCanvas
tipText
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
AngularController()
          Creates and initializes a new AngularController object with a minimum value of 0, maximum value of 100, and an initial value of 0.
AngularController(int min, int max, int initial)
          Creates and initializes a new AngularController object with the specified minimum, maximum, and initial values.
 
Method Summary
int angleToValue(double angle)
          This method converts a given angle to a value, using the pre-specified minimum and maximum values.
java.awt.Point getCentre()
          The method gets the center (x,y) position of the AngularController.
java.awt.Rectangle getDisplayRect()
          Gets the display rectangle for the AngularController.
java.awt.Rectangle getDisplayRect(java.awt.Dimension size)
          Gets the display rectangle for a given Dimension.
void paint(java.awt.Graphics g)
          This method is called to repaint the AngularController.
void paintTick(java.awt.Graphics g, int x, int y, double angle, int startXRadius, int endXRadius)
          This method paints a "Tick" at a specified angle given a Graphics context, x, y, startXRadius, and endXRadius values.
int pointToValue(int x, int y)
          This method converts a point (x, y) to a value.
int scaleForY(int xRadius)
          This method takes a radius and gives the Y scale for the current display rectangle.
int scaleForY(java.awt.Rectangle displayRect, int xRadius)
          This method takes a radius and a specified display rectangle and gives the Y scale.
double valueToAngle(int v)
          This method converts a given value to an angle, using the pre-specified minimum and maximum values.
 
Methods inherited from class com.pacist.diamonds.Controller
addControllerListener, getMaxValue, getMinValue, getPostOnMouseDown, getShowValue, getValue, getValueString, isMaxAtBottom, mouseDragged, mousePressed, mouseReleased, notifyValueChange, pinValue, pointToValue, processMouseEvent, processMouseMotionEvent, removeControllerListener, setMaxAtBottom, setMaxValue, setMinValue, setPostOnMouseDown, setShowValue, setValue
 
Methods inherited from class com.pacist.diamonds.DiamondCanvas
getTipText, mouseEnter, mouseExit, processMouseEvent, setTipText
 
Methods inherited from class java.awt.Canvas
addNotify, paint
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

AngularController

public AngularController()
Creates and initializes a new AngularController object with a minimum value of 0, maximum value of 100, and an initial value of 0.

AngularController

public AngularController(int min,
                         int max,
                         int initial)
Creates and initializes a new AngularController object with the specified minimum, maximum, and initial values.
Parameters:
min - The minimum value of the controller.
max - The maximum value of the controller.
initial - The initial value of the controller.
Method Detail

getDisplayRect

protected java.awt.Rectangle getDisplayRect()
Gets the display rectangle for the AngularController.
Returns:
The display rectangle for this AngularController.

getDisplayRect

protected java.awt.Rectangle getDisplayRect(java.awt.Dimension size)
Gets the display rectangle for a given Dimension.
Returns:
The display rectangle for a given Dimension.

valueToAngle

protected double valueToAngle(int v)
This method converts a given value to an angle, using the pre-specified minimum and maximum values.
Returns:
a double value.
See Also:
angleToValue(double)

angleToValue

protected int angleToValue(double angle)
This method converts a given angle to a value, using the pre-specified minimum and maximum values.
Returns:
an int value
See Also:
valueToAngle(int)

pointToValue

protected int pointToValue(int x,
                           int y)
This method converts a point (x, y) to a value.
Parameters:
x - The x coordinate.
y - The y coordinate.
Returns:
an int value.

Note : A value of 0 indicates the top.

Overrides:
pointToValue in class Controller

scaleForY

protected int scaleForY(int xRadius)
This method takes a radius and gives the Y scale for the current display rectangle.
Parameters:
xRadius - The radius.
Returns:
an int value.

scaleForY

protected int scaleForY(java.awt.Rectangle displayRect,
                        int xRadius)
This method takes a radius and a specified display rectangle and gives the Y scale.
Parameters:
displayRect - The display rectangle.
xRadius - The radius.
Returns:
an int value.

getCentre

protected java.awt.Point getCentre()
The method gets the center (x,y) position of the AngularController.
Returns:
a Point value.

paintTick

public void paintTick(java.awt.Graphics g,
                      int x,
                      int y,
                      double angle,
                      int startXRadius,
                      int endXRadius)
This method paints a "Tick" at a specified angle given a Graphics context, x, y, startXRadius, and endXRadius values.
Parameters:
g - The graphics context to use for painting.
x - The x offset.
y - The y offset.
angle - The angle.
startXRadius - The starting x radius.
endXRadius - The ending x radius.

paint

public void paint(java.awt.Graphics g)
This method is called to repaint the AngularController.
Parameters:
g - The graphics context to use for painting.
Overrides:
paint in class java.awt.Canvas

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD